test(dev): seed an inbound HTML conversation to exercise the UI sanitizer path - #33
Merged
Conversation
…tizer path The dev API seed (src/dev/seed.ts) only carried plain-text bodies, so the Agent Inbox UI's sanitized-HTML path (DOMPurify container, the "HTML email · sanitized · external images blocked" caption, the Show-original modal) was never fed real data in local dev — the design prototype's mock deliberately seeded an inbound <script> + tracking-pixel <img> for exactly this reason. Adds one inbound-only conversation whose thread carries a realistic bodyHtml (formatting + a link + a remote <img> + a <script>) alongside its bodyText, mirroring fixtures/mail/observed/html-body.json and spec §5's stored-XSS contract (the store returns untrusted HTML verbatim; the renderer sanitizes). Inbound-only, so it adds a conversation without perturbing the delivery-state distribution the test asserts. Verified: unit test green; booted `dev:api` and confirmed the API serves the HTML body verbatim (script/img/link/formatting intact) alongside bodyText. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe development seed now creates a seventh inbound-only conversation with plain-text and rich HTML content, including links, an image, and a script tag. Tests update conversation counts and verify the stored HTML payload and message attributes. ChangesRich HTML development seed
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds one inbound-only seeded conversation to the dev API harness (
src/dev/seed.ts) whose thread carries a realisticbodyHtml— formatting, a link, a remote<img>(tracking pixel), and a<script>— alongside itsbodyText.Why
The seed previously held only plain-text bodies. The Agent Inbox UI renders inbound
bodyHtmlthrough DOMPurify (spec §5's stored-XSS contract), but with no HTML in the seed the sanitizer path was never exercised against real data in local dev. The design prototype's mock deliberately seeded an inbound<script>document.title="pwned"</script>+ tracking-pixel<img>for exactly this reason; this restores that coverage in the engine's own dev seed so the UI's sanitized-HTML band, itsHTML email · sanitized · external images blockedcaption, and the Show-original modal all have real data to render.Shape
fixtures/mail/observed/html-body.jsonand spec §5 (specs/api/agent-inbox-v1.md): the store returns untrusted inbound HTML verbatim; sanitization is the renderer's job.sent/failed/pending) the test asserts.src/dev/seed.ts+src/dev/seed.test.ts), per the task.Verification
src/dev/seed.test.tsupdated (count 6→7, open 5→6) with a focused assertion that the HTML thread storesbodyHtmlverbatim (strong / link / img / script) alongsidebodyText. ✅npm run dev:apiand confirmed the live API serves the HTML body verbatim (script/img/link/formatting intact) next tobodyText. ✅🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests